// https://craco.js.org/docs/configuration/webpack/
const path = require('path');
module.exports = {
  webpack: {
    alias: {
      '@src': path.resolve(__dirname, 'src'),
      'components': path.resolve(__dirname, 'src/components'),
      'pages': path.resolve(__dirname, 'src/pages'),
      'utils': path.resolve(__dirname, 'src/utils'),
      'service': path.resolve(__dirname, 'src/service'),
      'api': path.resolve(__dirname, 'src/api'),
      'store': path.resolve(__dirname, 'src/store'),
    },
    plugins: {
      add: [ /* ... */ ],
      remove: [ /* ... */ ],
    },
    configure: (webpackConfig, { env, paths }) => {
      /* ... */
      return webpackConfig;
    },
  },
  devServer: { 
    open: false,
    // 配置代理解决跨域
    proxy: {
      '/api': {
        // target: 'http://192.168.0.249:8080', // 测试地址
        target: 'https://bianjitech.net.cn/api/', // 生产地址
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
   },
};